import { MessageBox } from "element-ui";

export function global() {
  const confirm = (params) => {
    MessageBox.confirm(params.message || "", params.title || "温馨提示", {
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      type: params.type || "warning",
      center: params.center || false
    }).then(() => {
      params.success && params.success(params.id || 0);
    }).catch(() => {
      params.fail && params.fail();
    });
  };
  return {
    confirm
  };
}
